Color with 4 floating point components: red, green, blue and alpha (r, g, b, a).
More...
#include <kanzi/core/math/color_rgba.hpp>
|
| ColorRGBA () |
| Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0).
|
|
| ColorRGBA (float r, float g, float b) |
| Constructor, initializes the color to (r, g, b, 1.0).
|
|
| ColorRGBA (float r, float g, float b, float a) |
| Constructor, initializes the color to (r, g, b, a).
|
|
| ColorRGBA (float v) |
| Constructor, initializes the color to (v, v, v, v).
|
|
float | getAlpha () const |
| Returns the alpha element of the color.
|
|
float | getBlue () const |
| Returns the blue element of the color.
|
|
float | getGreen () const |
| Returns the green element of the color.
|
|
float | getRed () const |
| Returns the red element of the color.
|
|
bool | hasNan () const |
| Returns true if and only if at least one of the vector values is NaN.
|
|
ColorRGBA & | operator*= (float scalar) |
| Multiplies each color element with a scalar.
|
|
ColorRGBA & | operator+= (const ColorRGBA &v) |
| Modifies this color by adding another color.
|
|
ColorRGBA & | operator+= (float scalar) |
| Adds a scalar to each color element.
|
|
ColorRGBA & | operator-= (const ColorRGBA &v) |
| Modifies this color by subtracting another color from this color.
|
|
ColorRGBA & | operator/= (float scalar) |
| Divides each color element with a scalar.
|
|
float & | operator[] (size_t index) |
| Access to individual elements of the color.
|
|
const float & | operator[] (size_t index) const |
| Access to individual elements of the color.
|
|
void | setAlpha (float value) |
| Sets the alpha element of the color.
|
|
void | setBlue (float value) |
| Sets the blue element of the color.
|
|
void | setGreen (float value) |
| Sets the green element of the color.
|
|
void | setRed (float value) |
| Sets the red element of the color.
|
|
|
static KZ_NO_DISCARD ColorRGBA | fromSRGB (float r, float g, float b) |
| Returns a linear color with each element set from a sRGB value.
|
|
static KZ_NO_DISCARD ColorRGBA | fromSRGB (float r, float g, float b, float a) |
| Returns a linear color with each element set from a sRGB value.
|
|
static ColorRGBA | highestValue () |
| Returns the color with each element having the most positive float value.
|
|
static ColorRGBA | lowestValue () |
| Returns the color with each element having the most negative float value.
|
|
static ColorRGBA | nan () |
| Returns the color with each element being NaN.
|
|
static ColorRGBA | negativeInfinity () |
| Returns the color with each element being the negative infinity.
|
|
static KZ_NO_DISCARD const ColorRGBA | one () |
| Returns the color with each element being one.
|
|
static ColorRGBA | opaqueBlack () |
| Returns opaque black color (0.0, 0.0, 0.0, 1.0).
|
|
static ColorRGBA | positiveInfinity () |
| Returns the color with each element being the positive infinity.
|
|
static ColorRGBA | transparentBlack () |
| Returns transparent black color (0.0, 0.0, 0.0, 0.0).
|
|
static KZ_NO_DISCARD const ColorRGBA | zero () |
| Returns the color with each element being zero.
|
|
Color with 4 floating point components: red, green, blue and alpha (r, g, b, a).
◆ ColorRGBA() [1/4]
kanzi::ColorRGBA::ColorRGBA |
( |
| ) |
|
|
inlineexplicit |
Default constructor, initializes the color to (0.0, 0.0, 0.0, 0.0).
◆ ColorRGBA() [2/4]
kanzi::ColorRGBA::ColorRGBA |
( |
float | v | ) |
|
|
inlineexplicit |
Constructor, initializes the color to (v, v, v, v).
- Parameters
-
v | Red, Green, Blue, and Alpha component of the color. |
◆ ColorRGBA() [3/4]
Constructor, initializes the color to (r, g, b, 1.0).
- Parameters
-
r | Red component of the color. |
g | Green component of the color. |
b | Blue component of the color. |
◆ ColorRGBA() [4/4]
Constructor, initializes the color to (r, g, b, a).
- Parameters
-
r | Red component of the color. |
g | Green component of the color. |
b | Blue component of the color. |
a | Alpha component of the color. |
◆ operator[]() [1/2]
const float & kanzi::ColorRGBA::operator[] |
( |
size_t | index | ) |
const |
|
inline |
Access to individual elements of the color.
- Parameters
-
index | Index of the accessed element. Should be either 0, 1, 2, or 3. |
- Returns
- If index is 0, r element. If index is 1, g element. If index is 2, b element. If index is 3, a element.
◆ operator[]() [2/2]
float & kanzi::ColorRGBA::operator[] |
( |
size_t | index | ) |
|
|
inline |
Access to individual elements of the color.
- Parameters
-
index | Index of the accessed element. Should be either 0, 1, 2, or 3. |
- Returns
- If index is 0, r element. If index is 1, g element. If index is 2, b element. If index is 3, a element.
◆ operator*=()
Multiplies each color element with a scalar.
- Parameters
-
scalar | Multiplier for each color element. |
- Returns
- This color.
◆ operator/=()
Divides each color element with a scalar.
- Parameters
-
scalar | Divider for each color element. |
- Returns
- This color.
◆ operator+=() [1/2]
Adds a scalar to each color element.
- Parameters
-
- Returns
- This color.
◆ operator+=() [2/2]
Modifies this color by adding another color.
- Parameters
-
- Returns
- This color.
◆ operator-=()
Modifies this color by subtracting another color from this color.
- Parameters
-
- Returns
- This color.
◆ zero()
Returns the color with each element being zero.
- Returns
- Color with zeroed elements.
◆ one()
Returns the color with each element being one.
- Returns
- Color with unit element values.
◆ fromSRGB() [1/2]
Returns a linear color with each element set from a sRGB value.
- Parameters
-
r | Red Channel (0-1.0) |
g | Green Channel (0-1.0) |
b | Blue Channel (0-1.0) |
a | Alpha Channel (0-1.0) |
- Returns
- Color in linear color space.
◆ fromSRGB() [2/2]
Returns a linear color with each element set from a sRGB value.
- Parameters
-
r | Red Channel (0-1.0) |
g | Green Channel (0-1.0) |
b | Blue Channel (0-1.0) |
- Returns
- Color in linear color space.
◆ getRed()
float kanzi::ColorRGBA::getRed |
( |
| ) |
const |
|
inline |
Returns the red element of the color.
- Returns
- The red element.
◆ getGreen()
float kanzi::ColorRGBA::getGreen |
( |
| ) |
const |
|
inline |
Returns the green element of the color.
- Returns
- The green element.
◆ getBlue()
float kanzi::ColorRGBA::getBlue |
( |
| ) |
const |
|
inline |
Returns the blue element of the color.
- Returns
- The blue element.
◆ getAlpha()
float kanzi::ColorRGBA::getAlpha |
( |
| ) |
const |
|
inline |
Returns the alpha element of the color.
- Returns
- The alpha element.
◆ setRed()
Sets the red element of the color.
- Parameters
-
value | The new value of the red element. |
◆ setGreen()
void kanzi::ColorRGBA::setGreen |
( |
float | value | ) |
|
|
inline |
Sets the green element of the color.
- Parameters
-
value | The new value of the green element. |
◆ setBlue()
void kanzi::ColorRGBA::setBlue |
( |
float | value | ) |
|
|
inline |
Sets the blue element of the color.
- Parameters
-
value | The new value of the blue element. |
◆ setAlpha()
void kanzi::ColorRGBA::setAlpha |
( |
float | value | ) |
|
|
inline |
Sets the alpha element of the color.
- Parameters
-
value | The new value of the alpha element. |
◆ lowestValue()
Returns the color with each element having the most negative float value.
- Returns
- Color with the lowest possible value.
◆ highestValue()
Returns the color with each element having the most positive float value.
- Returns
- Color with the highest possible value.
◆ nan()
Returns the color with each element being NaN.
- Returns
- Color with NaN elements.
◆ hasNan()
bool kanzi::ColorRGBA::hasNan |
( |
| ) |
const |
|
inline |
Returns true if and only if at least one of the vector values is NaN.
◆ positiveInfinity()
ColorRGBA kanzi::ColorRGBA::positiveInfinity |
( |
| ) |
|
|
inlinestatic |
Returns the color with each element being the positive infinity.
- Returns
- Color with positive infinity elements.
◆ negativeInfinity()
ColorRGBA kanzi::ColorRGBA::negativeInfinity |
( |
| ) |
|
|
inlinestatic |
Returns the color with each element being the negative infinity.
- Returns
- Color with negative infinity elements.
◆ opaqueBlack()
Returns opaque black color (0.0, 0.0, 0.0, 1.0).
- Returns
- Opaque black.
◆ transparentBlack()
ColorRGBA kanzi::ColorRGBA::transparentBlack |
( |
| ) |
|
|
inlinestatic |
Returns transparent black color (0.0, 0.0, 0.0, 0.0).
- Returns
- Transparent black color.
The documentation for this class was generated from the following file: